package cn.ultrarisk.scadmin.manager.biz.solr.context;

/**
 * SolrCacheType
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/5/12
 * @since V1.0
 */
public enum SolrCacheType {
    QUERY_RESULT_CACHE,
    FIELD_CACHE,
    DOCUMENT_CACHE,
    FIELD_VALUE_CACHE,
    PER_SEG_FILTER,
    FILTER_CACHE;

    public static SolrCacheType get(String type) {
        if (type != null) {
            try {
                for (SolrCacheType value : SolrCacheType.values()) {
                    if (value.toString().replaceAll("_", "").equals(type.toUpperCase())) {
                        return value;
                    }
                }
            } catch (Exception ignored) {
            }
        }
        return null;
    }
}
